<template>
    <!-- 
    <b-modal ref="my-modal" hide-footer title="Using Component Methods">
     <div class="d-block text-center">
       <h3>Hello From My Modal!</h3>
     </div>
     <b-button class="mt-3" variant="outline-danger" block @click="hideModal">Close Me</b-button>
     <b-button class="mt-2" variant="outline-warning" block @click="toggleModal">Toggle Me</b-button>
   </b-modal> 
    -->
    <!--
        body-class="modalStyle" 表示样式
        size="lg" 表示模态窗口大小 xl,lg,sm,full
        hide-footer 表示隐藏底部按钮
        hide-header 表示隐藏头部内容
        no-close-on-backdrop 表示鼠标点击背景不可关闭
        hide-header-close 表示隐藏头部关闭按钮
        centered 居中
        ok-title=“确定” 
        cancel-title=取消
        @ok="handleOk" 
        @cancel="handleCancel"
        scrollable 滚动条
        hide-backdrop 隐藏背景
        wrapClassName="ant-modal-cust-warp" 
        style="top:5%;height: 85%;overflow-y: hidden" 样式
    -->
    <b-modal ref="my-modal" size="lg" title="操作日志详情" hide-footer scrollable no-close-on-backdrop>
        <div class="d-block text-center">
            <!--begin::div-->
            <div class="m-form m-form--fit m-form--label-align-left m-form--group-seperator-dashed">
                <div class="m-portlet__body">
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3">开始时间</label>
                        <div class="col-lg-2">
                            <input class="form-control" type="text" maxlength="20" disabled v-model="operateForm.beginTime">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3">结束时间</label>
                        <div class="col-lg-2">
                            <input class="form-control" type="text" maxlength="20" disabled v-model="operateForm.endTime">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3">执行的类名</label>
                        <div class="col-lg-6">
                            <textarea class="form-control" maxlength="2147483647" rows="8" disabled v-model="operateForm.className" placeholder="请输入" ></textarea>
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="xt_operate_logMethod">执行的方法</label>
                        <div class="col-lg-6">
                            <input class="form-control" type="text" maxlength="800" disabled v-model="operateForm.action_" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3">方法</label>
                        <div class="col-lg-6">
                            <textarea class="form-control" maxlength="2147483647" rows="8" disabled v-model="operateForm.method" placeholder="请输入" ></textarea>
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3">拦截类型</label>
                        <div class="col-lg-2">
                            <div v-if="operateForm.type == 0">
                                <label class="col-form-label"><b-badge class="mr-1" variant="primary">业务</b-badge></label>
                            </div>
                            <div v-else-if="operateForm.type == 1">
                                <label class="col-form-label"><b-badge class="mr-1" variant="danger">参数拦截</b-badge></label>
                            </div>
                            <div v-else>
                                <label class="col-form-label"><b-badge class="mr-1" variant="secondary">未知</b-badge></label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="xt_operate_logMethodPar">方法参数</label>
                        <div class="col-lg-6">
                            <textarea class="form-control" maxlength="2147483647" disabled v-model="operateForm.param" placeholder="请输入"></textarea>
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="xt_operate_logResult">执行结果</label>
                        <div class="col-lg-6">
                            <textarea class="form-control" maxlength="2147483647" disabled v-model="operateForm.result" placeholder="请输入"></textarea>
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="xt_operate_logUri">访问地址</label>
                        <div class="col-lg-6">
                            <input class="form-control" type="text" maxlength="200" disabled v-model="operateForm.uri" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="max_memory">最大内存</label>
                        <div class="col-lg-6">
                            <input class="form-control" maxlength="10" value="0" disabled v-model="operateForm.maxMemory" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="total_memory">已分配内存</label>
                        <div class="col-lg-6">
                            <input class="form-control" maxlength="10" value="0"  disabled v-model="operateForm.totalMemory" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="free_memory">已分配内存中的剩余空间</label>
                        <div class="col-lg-6">
                            <input class="form-control" maxlength="10"  disabled v-model="operateForm.freeMemory" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="use_memory">最大可用内存</label>
                        <div class="col-lg-6">
                            <input class="form-control" maxlength="10"  disabled v-model="operateForm.useMemory" placeholder="请输入">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="total_time">执行总时间</label>
                        <div class="col-lg-6">
                            <input class="form-control" type="text" maxlength="20"  disabled v-model="operateForm.totalTime" placeholder="请输入" >
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-lg-3 control-label" jEhcLang="batch">批次</label>
                        <div class="col-lg-4">
                            <input class="form-control" type="text" maxlength="32"   disabled v-model="operateForm.batch">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3 ">操作时间</label>
                        <div class="col-lg-4">
                            <input class="form-control" type="text" maxlength="20" disabled v-model="operateForm.createTime">
                        </div>
                    </div>
                    <div class="form-group m-form__group row">
                        <label class="col-form-label col-lg-3">上&nbsp;&nbsp;传&nbsp;&nbsp;者</label>
                        <div class="col-lg-2">
                            <input class="form-control" type="text" maxlength="32" disabled v-model="operateForm.createBy">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <template slot="modal-footer">
            <!--自定义按钮-->
        </template>
    </b-modal>
</template>
<script>
import apiUtil from "@/core/util/apiUtil.js";
import { handleNotify, handleAlert, handleConfirm, showWating, closeWating } from "@/core/util/jehcUtil.js";
export default {
    data() {
        return {
            operateForm: {
                beginTime:"",
                endTime:"",
                className:"",
                action_:"",
                method:"",
                param:"",
                result:"",
                type:"",
                createTime: "",
                createBy: "",
                uri:"",
                maxMemory:"",
                totalMemory:"",
                freeMemory:"",
                useMemory:"",
                totalTime:"",
                batch:"",

            }
        }
    },
    components: {

    },
    watch: {
    },
    mounted() {

    },
    methods: {
        showModal(id) {
            this.restForm();
            this.$refs['my-modal'].show();
            this.getDetail(id);
        },
        hideModal() {
            this.$refs['my-modal'].hide()
        },
        toggleModal() {
            // 当模态已隐藏时，我们传递要返回焦点的按钮的ID
            this.$refs['my-modal'].toggle('#toggle-btn')
        },
        restForm() {
            //重置
            Object.assign(this.$data.operateForm, this.$options.data().operateForm);
        },
        getDetail(id){
            apiUtil.get(process.env.VUE_APP_LOG_API+"/logOperate/get/"+id).then(({ data }) => {
                this.operateForm = data.data;
            });
        },
    }
}
</script>